3 DIM F(12),WH$(20): REM FOR TWO DICE SIMULATION & SLOT WHEEL
6 FOR I = 1 TO 20
7 READ WH$(I)
8 NEXT I
9 DATA APPLE,PLUM,BELL,BAR,CHERRY,ORANGE,SEVEN,PLUM,BELL,BAR,CHERRY,ORANGE,PLUM,BELL,BAR,CHERRY,ORANGE,PLUM,BELL,BAR
10 IF PEEK(104) < >64 THEN POKE 104,64: POKE 16384,0: POKE 214,85: PRINT CHR$(4)"RUN PROBABILITY": REM LOAD PROGRAM ABOVE HGR PAGE 1
30 REM NEWTON'S APPLE - PROBABILITY
40 REM VERSION 3.04
50 REM 6-02-86
55 REM GAMBLING NOTICE ADDED 6-2-86
60 SCROLL$ = "<<< NEWTON'S APPLE >>>....": GOSUB 4290
70 HOME
80 INVERSE
90 HTAB 10: VTAB 10
100 PRINT "NEWTON'S APPLE PRESENTS"
110 HTAB 15: VTAB 15
120 FLASH
130 PRINT "PROBABILITY"
140 NORMAL
150 VTAB 24
160 FOR PAUSE = 1 TO 3300: NEXT
170 INPUT "Press the RETURN key to continue...";Q$
180 GOSUB 4260: GOSUB 4120
190 VTAB 12: HTAB 10: INVERSE : PRINT "FREEWARE FROM DU PONT": NORMAL
200 FOR I = 1 TO 2000: NEXT
210 GOSUB 4260: GOSUB 4120
220 REM Intro text starts here<CTRL-J><CTRL-J>
230 HTAB 8
240 PRINT "<CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C><CTRL-C>PROBABILITY - What is it?
250 VTAB 8
260 PRINT "PROBABILITY is the likeliness that an event will happen. If an event is very likely to happen, we say the PROBABILITY of the event is HIGH."
270 PRINT : PRINT : PRINT
280 PRINT "On the other hand, if an event is not likely to happen, we say the PROBABILITY is LOW."
290 VTAB 24
300 INPUT "Press return to continue...";Q$
310 REM *** WIPE ***<CTRL-J><CTRL-J>
320 GOSUB 4160
330 PRINT "Check your understanding..."
340 REM *** FIRST QUIZ ***<CTRL-J><CTRL-J>
350 VTAB 10
360 PRINT "If an event is VERY likely to happen we say that the PROBABILITY of the event is:
370 PRINT : PRINT
380 HTAB 10:
390 PRINT "A) LOW
400 PRINT : PRINT : PRINT
410 HTAB 10
420 PRINT "B) HIGH"
430 VTAB 23
440 INPUT "Enter the letter for the best choice: ";Q$
450 IF Q$ = "b" OR Q$ = "B" THEN 520: REM GOT IT RIGHT!
460 IF Q$ < >"a" AND Q$ < >"A" THEN 430
470 HOME : VTAB 8
480 PRINT "Sorry, that's not right. Take another look at our definition for PROBABILITY."
490 VTAB 23:
500 INPUT "Press return to review...";Q$
510 GOTO 210
520 GOSUB 4220
530 GOSUB 4570
540 VTAB 8
550 PRINT "Good job, the probability would be high"
560 VTAB 23: INPUT "Press return to learn more...";Q$
570 REM *** ZERO AND ONE ****
580 HOME
590 HTAB 12
600 INVERSE : PRINT "ZERO OR ONE ???": NORMAL
610 PRINT : PRINT
620 PRINT "The probability of an event can be expressed with numbers:"
630 VTAB 10
640 PRINT "If there is NO CHANCE of an event happening, the probability is said to be 0 (zero)."
650 VTAB 17
660 PRINT "If there is EVERY chance that an event will happen, the probability is said to be 1 (one)."
670 VTAB 23
680 INPUT "Press return to continue...";Q$
690 HOME
700 HTAB 5
710 PRINT "Time for another little quiz.."
720 VTAB 8
730 PRINT "If there is NO WAY that an event can happen, the probability of that event is:"
740 PRINT
750 PRINT TAB( 15);"A) One"
760 PRINT
770 PRINT TAB( 15);"B) Zero"
780 VTAB 22
790 INPUT "Please choose the letter of the correct answer: ";Q$
800 IF Q$ = "B" OR Q$ = "b" THEN 880: REM GOT IT RIGHT!
810 IF Q$ < >"a" AND Q$ < >"A" THEN 780
820 HOME
830 VTAB 10
840 PRINT "Oops! That's not right.....Better review a bit..."
950 PRINT "Some events, such as the flipping of a coin have TWO possible outcomes. In these cases a little arithmetic will help us to calculate the probability of the event coming out one particular way."
960 VTAB 23
970 INPUT "Press return for more...";Q$
980 GOSUB 4160
990 PRINT "In the case of a flipped coin, there are TWO possible results (HEADS and TAILS).
1000 PRINT : PRINT : PRINT "To calculate the PROBABILITY of getting Heads on a flip we must divide the number of ways of winning (getting heads) by the total possible outcomes. In our example the total number of"
1010 PRINT "possible outcomes is TWO (Heads or TAILS)."
1020 PRINT : PRINT : PRINT "Ways to get HEADS = 1
1030 PRINT : PRINT "Total possible outcomes = 2
1040 PRINT : PRINT "Probability of getting HEADS:"
1050 PRINT : PRINT "1 divided by 2 = .5"
1060 VTAB 24
1070 INPUT "Press return for more...";Q$
1080 GOSUB 4160
1090 PRINT "Notice that the probability will be expressed as a decimal number between zero and one."
1100 VTAB 10
1110 PRINT "A probability of .5 (or one half) means that if you flip a coin many times, it will come up heads about half of the time."
1120 VTAB 23
1130 INPUT "Press return for more...";Q$
1140 GOSUB 4140
1150 HTAB 10: INVERSE : PRINT "MAKING A PREDICTION": NORMAL
1160 PRINT : PRINT
1170 PRINT "Once you have calculated the probability of an event (such as a coin coming up heads), you can predict (make an educated guess) how many HEADS you should get from a total number of flips"
1180 PRINT : PRINT : PRINT "Take the CALCULATED PROBABILITY (.5 for our example) and multiply it by the total number of trials (coin flips in our example)
1190 VTAB 23
1200 INPUT "Press return for an example...";Q$
1210 GOSUB 4180
1220 HTAB 9: INVERSE : PRINT "CALCULATING OUR GUESS": NORMAL
1230 PRINT : PRINT : PRINT TAB( 29);"EXPECTED"
1240 PRINT "PROBABILITY x # OF TRIALS = FAVORABLE"
1250 PRINT TAB( 29);"OUTCOMES"
1260 PRINT : PRINT "For our coin flip example:"
1270 PRINT : PRINT : PRINT ".5 x NUMBER OF TRIALS = EXPECTED HEADS"
1280 N = INT( RND(8) *200 +2)
1290 PRINT : PRINT : PRINT "If we flipped a coin ";N;" times, how": INPUT "many HEADS would you predict? ";Q$
1300 IF ABS(N/2 - VAL(Q$)) <1.1 THEN GOSUB 4570: VTAB 10: PRINT : INVERSE : PRINT "GOOD!";: NORMAL : PRINT " YOU HAVE THE IDEA!": GOTO 1330
1310 PRINT : PRINT : INVERSE : PRINT "OOPS! ";: NORMAL : PRINT "Try again.": VTAB 24: INPUT "Press return for another try...";Q$
1320 GOTO 1140: REM GOT IT WRONG - RELEARN
1330 VTAB 23: INPUT "Press return to try out your prediction";Q$
1340 GOSUB 4160: REM START COIN FLIP SIMULATION<CTRL-J><CTRL-J>
1350 PRINT "Sometimes a computer can be used to SIMULATE an experiment. Computer simulations are useful when you don't have the time or materials for a real experiment."
1360 VTAB 20
1370 INPUT "Press return and you can SIMULATE the flipping of a coin...";Q$
1690 HTAB 11: INVERSE : PRINT "SUMMARY OF RESULTS": NORMAL
1700 PRINT : PRINT "NUMBER OF TRIALS = ";N
1710 PRINT : PRINT "PREDICTED HEADS = ";P
1720 PRINT : PRINT "ACTUAL HEADS = ";HEADS
1730 IF HEADS = 0 THEN PRINT : PRINT : PRINT "EXPERIMENTAL VALUE FOR HEADS IS ZERO. WE CAN'T MAKE A PERCENT COMPARISON.": GOTO 1750: REM AVOID DIV BY 0 ERROR
1750 IF F1 = 1 THEN 1830: REM WE'VE ALREADY READ THIS
1760 PRINT : PRINT : PRINT : PRINT "As you can see, the predicted result does not exactly match the experimental result."
1770 VTAB 23: INPUT "Press return for an explanation...";Q$
1780 GOSUB 4160
1790 PRINT : PRINT "This is because probability is the PROBABLE outcome of an event. It is possible (but unlikely) that you could flip a coin 1000 times and its would come up heads 1000 times!"
1800 PRINT : PRINT "Each flip is an independant event and it is not affected by any other flip. Got it?"
1810 F1 = 1: REM WE'VE READ THIS ONCE!!
1820 PRINT : PRINT : PRINT : PRINT : PRINT : PRINT "Now you have a choice:"
2130 PRINT : PRINT : PRINT "That's right. There is only one way to get a ";X;" and 6 possible outcomes for rolling a single die. So the answer had to be 1/6 = .17": VTAB 23: INPUT "Press return to continue...";Q$: GOTO 2260
2140 REM *** HELP ***<CTRL-J><CTRL-J>
2150 GOSUB 4160
2160 HTAB 4: INVERSE : PRINT "HELP FROM YOUR FRIENDLY COMPUTER": NORMAL
2170 PRINT : PRINT "Remember the rule for calculating the probability of an event:"
2180 PRINT : PRINT "Ways to get a favorable outcome divided by total possible outcomes = PROBABILITY"
2190 PRINT : PRINT "Ways to get a ";X;" ... 1"
2200 PRINT : PRINT "Total possible outcomes ... 6"
2210 PRINT : PRINT "So:"
2220 PRINT : PRINT TAB( 10);"1 / 6 = .17"
2230 VTAB 23: INPUT "Press return for another chance...";Q$
2240 GOTO 1920: REM BACK TO THE QUESTION
2250 REM *** PROG CONTINUES ***<CTRL-J><CTRL-J>
2260 GOSUB 4120
2270 HTAB 12: INVERSE : PRINT "MORE FUN STUFF !!": NORMAL
2280 PRINT : PRINT
2290 PRINT "Now you will have a chance to test the expected .17 probability of a single roll of a die. You will be given the opportunity to roll a single die many times. The computer will show you what
2300 PRINT "number has come up for each roll.
2310 PRINT "The computer will also show what percent of the total rolls is represented by each face of the die."
2320 PRINT : PRINT : PRINT
2330 PRINT : PRINT "It should be noted that the expected probability of .17 would be 17 percent as displayed by the computer."
2340 VTAB 23
2350 INPUT "Press return to roll the die...";Q$
2360 REM <CTRL-J><CTRL-J>*** SINGLE DIE ROLL ***<CTRL-J><CTRL-J>
2370 HOME
2380 FOR I = 1 TO 6:R(I) = 0: NEXT : REM CLEAR ARRAY
2390 N = 0
2400 HTAB 11
2410 INVERSE
2420 PRINT "COMPUTER SIMULATION"
2430 HTAB 10
2440 PRINT "ROLLS OF A SINGLE DIE"
2450 NORMAL
2460 VTAB 4: PRINT " NUMBER OF ROLLS: "
2470 PRINT
2480 PRINT " NUMBER TIMES PERCENT"
2490 PRINT " THAT NUMBER OF"
2500 PRINT " CAME UP CAME UP ROLLS"
2510 PRINT " ------- ------- -----"
2520 HTAB 6: VTAB 11: PRINT "1"
2530 HTAB 6: VTAB 13: PRINT "2"
2540 HTAB 6: VTAB 15: PRINT "3"
2550 HTAB 6: VTAB 17: PRINT "4"
2560 HTAB 6: VTAB 19: PRINT "5"
2570 HTAB 6: VTAB 21: PRINT "6"
2580 VTAB 23: PRINT "SPACE BAR TO STOP ANY OTHER KEY TO GO"
2780 K = PEEK( -16384) -128: IF K = 32 THEN FOR P = 1 TO 30: NEXT P: GET Q$: GET Q$: POKE -16384,0
2790 IF K = 67 OR K = 99 THEN GET Q$: POKE -16384,0: GOTO 2830
2800 IF K = 81 OR K = 113 THEN GET Q$: POKE -16384,0: GOTO 3950
2810 GOTO 2610
2820 REM <CTRL-J><CTRL-J>*** PART 3 - TWO DICE ***<CTRL-J><CTRL-J>
2830 GOSUB 4160
2840 HTAB 12: INVERSE : PRINT "EXTRA CHALLENGE": NORMAL
2850 PRINT
2860 PRINT "A more challenging problem can be posed by calculating the probability of each sum that results from adding the rolls of two six sided dice."
2870 FOR P = 1 TO 5000: NEXT
2880 PRINT : PRINT "See if you can calculate the probability of each sum that can be produced by rolling two dice."
2890 FOR P = 1 TO 5000: NEXT
2900 PRINT : PRINT "To do this you will need to make a table of all the combinations of a two dice roll. (There are 36 combinations)"
2910 VTAB 23: INPUT "Press return for a sample table ";Q$
2920 GOSUB 4140
2930 PRINT "You need to find all the ways of rolling a two, all the ways of rolling a three and so on. One way to do this is to write out a table showing all the possible ways that two dice can roll."
2940 PRINT : PRINT "DIE 1 DIE 2 SUM"
2950 PRINT "----- ----- ---"
2960 PRINT : PRINT " 1 1 2"
2970 PRINT : PRINT " 1 2 3"
2980 PRINT : PRINT " 1 3 4"
2990 PRINT : PRINT " 1 4 5"
3000 PRINT : PRINT " 1 5 6"
3010 PRINT : PRINT " 1 6 7"
3020 PRINT : PRINT " 2 1 3"
3030 HTAB 32: VTAB 12: PRINT "Here"
3040 HTAB 33: PRINT "is"
3050 HTAB 34: PRINT "a"
3060 HTAB 31: PRINT "partial"
3070 HTAB 32: PRINT "table"
3080 VTAB 24: INPUT "Press return to continue... ";Q$
3090 GOSUB 4140
3100 REM <CTRL-J><CTRL-J>
3110 HTAB 11: INVERSE : PRINT "NOW IT'S YOUR TURN": NORMAL
3120 VTAB 5: PRINT "Complete the table on a piece of paper. Then count how many ways there are to roll a two by adding the numbers on the two dice."
3130 VTAB 23: INPUT "Press return when your chart is complete";Q$
3140 REM <CTRL-J><CTRL-J>**** WIPE ***<CTRL-J><CTRL-J>
3150 GOSUB 4120
3160 PRINT : PRINT : PRINT "Remember:"
3170 PRINT : PRINT "PROBABILITY = WAYS TO GET A 2/TOTAL WAYS"
3180 PRINT : PRINT : PRINT "If you check your chart, you will find that there is only one way to roll a two. (DIE 1 = 1 and DIE 2 = 1)"
3190 PRINT : PRINT : PRINT "By counting all the combinations on your chart, you should see that there are 36 TOTAL WAYS that the dice can roll."
3200 PRINT : PRINT "Use the formula to calculate the PROBABILITY of rolling a TWO (Your answer should be a decimal rounded to the hundredths place)
3210 VTAB 24: INPUT "Press return when you have your answer ";Q$
3220 REM <CTRL-J><CTRL-J>*** WIPE **<CTRL-J><CTRL-J>
3230 HOME
3240 VTAB 8: PRINT "What is the probability of rolling two"
3250 PRINT "dice and having their sum equal TWO? "
3260 PRINT : PRINT "Type in your answer. Don't forget to type in the decimal point and round to the hundredths place (two numbers after the decimal point)
3270 PRINT : PRINT
3280 INPUT "Your answer? --> ";Q$
3290 IF LEFT$(Q$,1) < >"0" AND LEFT$(Q$,1) < >"." THEN 3230: REM NOT A DECIMAL
3300 IF VAL(Q$) = .03 THEN GOSUB 4220: GOSUB 4570: VTAB 10: HTAB 14: INVERSE : PRINT "GOOD JOB !!!": NORMAL : GOTO 3380
3310 IF ABS( VAL(Q$) -.027777) <.01 THEN HOME : VTAB 10: PRINT "That's pretty close!": PRINT : PRINT "You may not have rounded quite right.": GOTO 3380
3320 HOME
3330 : INVERSE : HTAB 16: PRINT "OOPS !!!": NORMAL
3340 VTAB 10: PRINT "Sorry, that's not the answer."
3350 PRINT : PRINT "You want to divide the WAYS TO ROLL A TWO by the TOTAL POSSIBLE ROLLS"
3360 VTAB 23: INPUT "Press return to continue...";Q$
3370 GOTO 3150: REM TRY AGAIN
3380 VTAB 23: INPUT "Press return to do an experiment...";Q$
3390 REM <CTRL-J><CTRL-J>*** WIPE ***<CTRL-J><CTRL-J>
3400 GOSUB 4160
3410 HTAB 11: INVERSE : PRINT "MAKING PREDICTIONS": NORMAL
3420 PRINT : PRINT "Now calculate the probabilities for rolling each of the possible sums of a two dice roll."
3430 PRINT : PRINT "Write your answers down as you go. When you have calculated all the answers (there are 11 answers in all) you can do another computer simulated experiment."
3440 VTAB 23: INPUT "Press return to get experimental data..";Q$
3450 N = 0:SUM = 0: FOR I = 2 TO 12:F(I) = 0: NEXT
3460 REM <CTRL-J><CTRL-J>*** 2 DICE SIMULATION ***<CTRL-J><CTRL-J>
3470 REM <CTRL-J><CTRL-J>*** WIPE ***<CTRL-J><CTRL-J>
3810 POKE -16368,0:K = PEEK( -16384): IF K = 32 THEN 3840
3820 GOTO 3610
3830 REM <CTRL-J><CTRL-J>*** WIPE ***<CTRL-J><CTRL-J>
3840 GOSUB 4120
3850 HTAB 10: INVERSE : PRINT "CHECK YOUR PREDICTION": NORMAL
3860 PRINT
3870 PRINT "Check to see how your calculated probabilities compare with the experimental results. To compare probability to percent, just multiply your probability by 100!"
3880 PRINT : PRINT "The reliability of the experimental result will increase as the number of rolls increases so you might want to letthe simulation go for a while."
3890 VTAB 22: PRINT "Press 'E' to end the simulation"
3900 PRINT "Press return to continue...";
3910 GET Q$: IF Q$ = "E" OR Q$ = "e" THEN GOTO 11030: REM SLOTS
3920 IF Q$ = CHR$(13) THEN 3480: REM CONTINUE SIMULATION
3930 GOTO 3910: REM MUST BE 13 OR E
3940 REM <CTRL-J><CTRL-J>*** WIPE ***
3950 GOSUB 4160
3960 HTAB 12: INVERSE : PRINT "LAST CHANCE MENU": NORMAL
3970 PRINT : PRINT
3980 PRINT "I hope you have had fun and learned a little about probability."
3990 PRINT : PRINT "Here are your choices:"
4000 PRINT : PRINT TAB( 5);"A) Coin toss"
4010 PRINT : PRINT TAB( 5);"B) Roll one die"
4020 PRINT : PRINT TAB( 5);"C) Roll two dice"
4030 PRINT : PRINT TAB( 5);"D) Play the slots"
4035 PRINT : PRINT TAB( 5);"E) Quit"
4040 VTAB 23: INPUT "Enter your choice and press return: ";Q$
4050 IF Q$ = "a" OR Q$ = "A" THEN 1380
4060 IF Q$ = "b" OR Q$ = "B" THEN 2260
4070 IF Q$ = "c" OR Q$ = "C" THEN 3450
4080 IF Q$ = "d" OR Q$ = "D" THEN 11000
4085 IF Q$ = "e" OR Q$ = "E" THEN 4580
4090 GOTO 4040
4100 REM <CTRL-J><CTRL-J>*** WIPE SUBROUTINES ***<CTRL-J><CTRL-J>
4110 REM LEFT/RIGHT WIPE
4120 FOR I = 1 TO 40: POKE 33,I: HOME : GOSUB 4270: NEXT : RETURN
4130 REM RIGHT/LEFT WIPE
4140 FOR I = 39 TO 0 STEP -1: POKE 32,I: POKE 33,40 -I: HOME : GOSUB 4270: NEXT : RETURN
4150 REM CENTER OUT WIPE
4160 FOR I = 1 TO 20: POKE 32,20 -I: POKE 33,2 *I: HOME : GOSUB 4270: NEXT : RETURN
4170 REM UP WIPE
4180 FOR I = 24 TO 1 STEP -1: VTAB I: HTAB 1: CALL -868: GOSUB 4270: NEXT : RETURN
4210 REM STRIPE WIPE
4220 INVERSE : FOR I = 1 TO 24: VTAB I: HTAB 1: INVERSE : PRINT SPC( 40): VTAB I: HTAB 1: NORMAL : PRINT SPC( 40): NEXT : HOME : RETURN
4250 REM HYPE WIPE
4260 VTAB 1: HTAB 1: FOR I = 1 TO 23: PRINT "NEWTON'S APPLE. NEWTON'S APPLE. ";: NEXT : FOR J = 1 TO 500: NEXT : RETURN
4270 FOR J = 1 TO 22: NEXT : RETURN
4280 REM <CTRL-J><CTRL-J>*** APPLE LOGO SUBROUTINE ***<CTRL-J><CTRL-J>
4290 HOME
4300 REM <CTRL-J><CTRL-J>SCROLL$ STORES MESSAGE<CTRL-J><CTRL-J>
4310 HGR
4320 REM <CTRL-J><CTRL-J>NEXT HCOLOR IS FOR BODY OF THE APPLE<CTRL-J><CTRL-J>
4330 HCOLOR= 3
4340 FOR I = 1 TO 22
4350 READ X,Y,X1,Y1
4360 HPLOT X +85,Y TO X1 +85,Y1
4370 HPLOT 193 -X,Y TO 193 -X1,Y1
4380 NEXT I
4390 REM <CTRL-J><CTRL-J>NEXT HCOLOR IS FOR LEAF OF THE APPLE<CTRL-J><CTRL-J>
4400 HCOLOR= 3
4410 FOR I = 1 TO 15
4420 REM <CTRL-J><CTRL-J>NEXT HCOLOR IS FOR STEM OF THE APPLE<CTRL-J><CTRL-J>
4430 IF I = 6 THEN HCOLOR= 3
4440 READ X,Y,X1,Y1
4450 HPLOT X +85,Y TO X1 +85,Y1
4460 NEXT I
4470 VTAB 23:A$ = SCROLL$ +" PRESS ANY KEY TO CONTINUE..... "
4480 POKE -16368,0
4490 HTAB 1: PRINT LEFT$(A$,39);:A$ = MID$ (A$,2) + LEFT$(A$,1):K = PEEK( -16384): IF K <128 THEN FOR K = 1 TO 25: NEXT K:K = FRE(0):X = RND(8): GOTO 4490
4500 PRINT CHR$(7)
4510 POKE -16368,0: REM RESET KEYBOARD STROBE
4520 TEXT : HOME : RESTORE : RETURN
4530 DATA 11,92,11,102,13,106,13,87,15,84,15,109,17,112,17,82, 19,80,19,116,21,118,21,78,23,76,23,121,25,123,25,75,27,74,27 ,125,29,127,29,74,31,73,31,128,33
4540 DATA 129,33,73,35,72,35,130,37,131,37,72,39,72,39,131,41 ,131,41,73,43,74,43,131,45,130,45,75,47,76,47,130,49,130,49, 77,51,78,51,129,53,128,53,78
4550 DATA 37,58,37,64,39,66,39,57,41,57,41,67,43,67,43,58,45,61,45,68,47,68,47,64,52,68,52,74,54,75,54,66,56,61,56,74,58,73,58,58,60,56,60,71,62,69,62,54,64,52,64,66,66,63,66,51,68,53,68,60
4560 REM <CTRL-J><CTRL-J>*** REWARD SUBROUTINE ***
4570 HOME : POKE 49239,0: POKE 49232,0: FOR J = 1 TO 1000: NEXT : TEXT : FOR J = 1 TO 20: NEXT : RETURN
4580 GOSUB 4260: FOR I = 1 TO 1000: NEXT : HOME : VTAB 8: PRINT "Note: This program uses gambling as a demonstration of an application of the laws of probability. Gambling is an attempt to overcome the laws of"
4590 PRINT "probability. This program is in no way intended to advocate gambling as an activity."
4595 FOR I = 1 TO 5000: NEXT : PRINT CHR$(4)"RUN STARTUP"
5000 END
11000 REM <CTRL-J><CTRL-J>*** SLOT SUBROUTINE ***<CTRL-J><CTRL-J>
11020 REM SLOT -- FOR PROBABILITY
11030 GOSUB 4120
11040 HTAB 14: INVERSE : PRINT "THE BIG WIN": NORMAL
11050 PRINT : PRINT : PRINT "Slot machines are a familiar gambling"
11060 PRINT "device. Let's look at the probability"
11070 PRINT "of "; CHR$(34);"HITTING THE JACKPOT"; CHR$(34);" in a standard"
11080 PRINT CHR$(34);"One Armed Bandit"; CHR$(34)
11090 VTAB 23: INPUT "Press return to continue...";Q$
11100 GOSUB 4140
11110 PRINT "A slot machine consists of 3 wheels"
11120 PRINT "with each wheel having 20 symbols. In"
11130 PRINT "order to hit the jackpot, a seven must"
11140 PRINT "appear in all three windows:"
11150 HTAB 10: VTAB 10: PRINT "SEVEN SEVEN SEVEN"
11160 VTAB 23: INPUT "Press return for more...";Q$
11170 GOSUB 4160
11180 PRINT "On each wheel, only 1 out of 20 symbols"
11190 PRINT "is a SEVEN."
11200 PRINT : PRINT : PRINT "Therefore the probability of getting a"
11210 PRINT "SEVEN on one wheel is 1 out of 20 or a"
11220 PRINT "probability of .05."
11230 VTAB 23: INPUT "Press return to continue...";Q$
11240 GOSUB 4120
11250 HTAB 8: INVERSE : PRINT "THE ODDS ARE AGAINST US": NORMAL
11260 PRINT : PRINT : PRINT "To find the odds of getting two sevens"
11270 PRINT "we must multiply the odds of getting a"
11280 PRINT "SEVEN in the first window by the odds"
11290 PRINT "of getting a SEVEN in the second window"
11300 VTAB 10: PRINT " 1 1 1"
11310 PRINT " -- X -- = ---"
11320 PRINT " 20 20 400"
11330 VTAB 23: INPUT "Press return to continue...";Q$
11340 GOSUB 4140
11350 PRINT "In order to get the jackpot, we need"
11360 PRINT "sevens in all three windows. To"
11370 PRINT "calculate the probability of this"
11380 PRINT "we must multiply the individual chances"
11390 PRINT "of getting a SEVEN in each of the three"
11400 PRINT "windows:"
11410 PRINT : PRINT : PRINT
11420 PRINT " 1 1 1 1"
11430 PRINT "-- X -- X -- = ----"
11440 PRINT "20 20 20 8000
11450 VTAB 16: PRINT "As you can see, the probability of"
11460 PRINT "hitting the jackpot is a tiny one"
11470 PRINT "chance out of 8000! Written as a"
11480 PRINT "decimal, this is a probability of"
11490 PRINT ".000125 - NOT VERY GOOD!"
11500 VTAB 24: INPUT "Press return to try to beat the odds...";Q$
11510 GOSUB 4160
11520 HTAB 10: INVERSE : PRINT "CAN YOU BEAT THE ODDS?": NORMAL
11530 PRINT : PRINT "We will now do a computer simulation"
11540 PRINT "of a slot machine or " CHR$(34);"one armed bandit"; CHR$(34)"."
11550 PRINT : PRINT "Since our goal is to hit the jackpot,"
11560 PRINT "we won't worry about ways to win small"
11570 PRINT "amounts."
11580 VTAB 23: INPUT "Press return to play...";Q$
11590 HOME
11600 HTAB 10: INVERSE : PRINT "NEWTON'S CASINO": NORMAL
11790 IF W1 = 7 AND W2 = 7 AND W3 = 7 THEN VTAB 13: INVERSE : FOR I = 1 TO 10: PRINT CHR$(7);: NEXT : PRINT : PRINT "CONGRATULATIONS...YOU BEAT THE ODDS!!!": NORMAL
11800 VTAB 22: HTAB 1: PRINT "Press SPACEBAR to play again..."